package com.horoscope.astrology.zodiac.signs.free.view;


import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;

import com.jeremyliao.liveeventbus.LiveEventBus;

/**
 * 作者    1024
 * 时间    2020/4/22 下午12:17
 * 文件    QiaoRecyclerView-master
 * 描述    每次滑动一个item到rv中间
 */
public class ViewPagerSnapHelper extends PagerSnapHelper {

    @Override
    public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX, int velocityY) {
        int position = super.findTargetSnapPosition(layoutManager, velocityX, velocityY);
        LiveEventBus.get("quotePosition", int.class).post(position);
        return position;
    }
}
